package com.hjm.project.channel.agent.service.impl;

import java.util.List;
import com.hjm.common.utils.DateUtils;
import org.springframework.stereotype.Service;
import com.hjm.project.channel.agent.mapper.ChannelAgentMapper;
import com.hjm.project.channel.agent.domain.ChannelAgent;
import com.hjm.project.channel.agent.service.IChannelAgentService;
import com.hjm.common.utils.text.Convert;

import javax.annotation.Resource;

/**
 * 渠道代理商Service业务层处理
 * 
 * @author maker-platform
 * @date 2025-05-21
 */
@Service
public class ChannelAgentServiceImpl implements IChannelAgentService {
    @Resource
    private ChannelAgentMapper channelAgentMapper;

    /**
     * 查询渠道代理商
     * 
     * @param id 渠道代理商ID
     * @return 渠道代理商
     */
    @Override
    public ChannelAgent selectChannelAgentById(String id) {
        return channelAgentMapper.selectChannelAgentById(id);
    }
    @Override
    public ChannelAgent selectChannelAgentByAgentId(String agentId) {
        return channelAgentMapper.selectChannelAgentByAgentId(agentId);
    }

    /**
     * 查询渠道代理商列表
     * 
     * @param channelAgent 渠道代理商
     * @return 渠道代理商
     */
    @Override
    public List<ChannelAgent> selectChannelAgentList(ChannelAgent channelAgent) {
        return channelAgentMapper.selectChannelAgentList(channelAgent);
    }

    /**
     * 查询渠道代理商列表
     *
     * @param channelAgent 渠道代理商
     * @return 渠道代理商 一个结果
     */
    @Override
    public ChannelAgent selectChannelAgentOne(ChannelAgent channelAgent) {
        return channelAgentMapper.selectChannelAgentOne(channelAgent);
    }

    /**
     * 新增渠道代理商
     * 
     * @param channelAgent 渠道代理商
     * @return 结果
     */
    @Override
    public int insertChannelAgent(ChannelAgent channelAgent) {
        channelAgent.setCreateTime(DateUtils.getNowDate());

        return channelAgentMapper.insertChannelAgent(channelAgent);
    }

    /**
     * 修改渠道代理商
     * 
     * @param channelAgent 渠道代理商
     * @return 结果
     */
    @Override
    public int updateChannelAgent(ChannelAgent channelAgent) {
        channelAgent.setUpdateTime(DateUtils.getNowDate());
        return channelAgentMapper.updateChannelAgent(channelAgent);
    }

    /**
     * 删除渠道代理商对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteChannelAgentByIds(String ids) {
        return channelAgentMapper.deleteChannelAgentByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除渠道代理商信息
     * 
     * @param id 渠道代理商ID
     * @return 结果
     */
    @Override
    public int deleteChannelAgentById(String id) {
        return channelAgentMapper.deleteChannelAgentById(id);
    }

    @Override
    public ChannelAgent selectChannelAgentByChannelAgentId(String cAgentId) {
        return channelAgentMapper.selectChannelAgentByChannelAgentId(cAgentId);
    }
}
